package com.zjht.gmcc.servlet.pdt;

import java.io.PrintWriter;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zjht.gmcc.bean.BaseServlet;
import com.zjht.gmcc.bean.util.MyJDBC;


public class CheckBig extends BaseServlet {

	private static final long serialVersionUID = 1L;

	public boolean process(HttpServletRequest request, HttpServletResponse response,HttpSession session, PrintWriter out, MyJDBC myJDBC,  String menu)throws Exception {
		response.setContentType("text/xml;charset=GBK" );
		
		response.setHeader("Cache-Control", "no-cache");

		String key = request.getParameter("typename");
		String s_typename =java.net.URLDecoder.decode(key,"UTF-8");
		StringBuilder sb = new StringBuilder("<state>");

		String s_sql = "SELECT typename FROM Producttype WHERE levelid='1' and UPPER(typename) = UPPER(?)";
		PreparedStatement ps = myJDBC.prepareStatement(s_sql);
		ps.setString(1, s_typename);
		ResultSet rs = ps.executeQuery();

		if (rs.next()) {
			sb.append("<aaa>1</aaa>");
		} else {
			sb.append("<aaa>0</aaa>");
		}

		s_sql = null;
		rs.close();
		rs = null;
		ps.close();
		ps = null;

		sb.append("</state>");
		out.write(sb.toString());		
		return true;
	}
}
